
if exists (select 1 from sysobjects where name = 'del_prsabteilung' and type = 'P')
begin
   drop procedure del_prsabteilung
   print 'Procedure: del_prsabteilung deleted ...'
end
go
create procedure del_prsabteilung(
  @abteilungid      int   = 1,
  @prsid            int   = 1,
  @von             char(8) = '20070501',
  @bis             char(8) = '20090501'
)
as
begin
  set nocount on

   delete from PersonalAbteilung 
    where PrsId = @prsid
      and AbteilungID = @abteilungid
      and Von = @von
      and Bis = @bis

end
go
print 'Procedure: del_prsabteilung done ...'
go
grant exec on del_prsabteilung to prsadmins with grant option
go
grant exec on del_prsabteilung to prsusers
go

